import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'

// 路由配置
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Layout',
    component: () => import('../views/Layout.vue'),
    redirect: '/attendance-types',
    children: [
      {
        path: 'attendance-types',
        name: 'AttendanceTypes',
        component: () => import('../views/attendance-types/index.vue'),
        meta: { title: '考勤类型管理', icon: 'List' }
      },
      {
        path: 'employees',
        name: 'Employees',
        component: () => import('../views/employees/index.vue'),
        meta: { title: '员工信息管理', icon: 'User' }
      },
      {
        path: 'attendance-records',
        name: 'AttendanceRecords',
        component: () => import('../views/attendance-records/index.vue'),
        meta: { title: '考勤记录管理', icon: 'Calendar', requiresAuth: true }
      },
      {
        path: 'statistics',
        name: 'Statistics',
        component: () => import('../views/statistics/index.vue'),
        meta: { title: '考勤统计', icon: 'PieChart', requiresAuth: true }
      }
    ]
  },
  {
    path: '/:pathMatch(.*)*',
    name: 'NotFound',
    component: () => import('../views/error/404.vue')
  }
]

// 创建路由实例
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router 